Analytics systems track users accessing pages of electronic content such as webpages. Analytics are generally implemented in conventional webpages using page-specific imperative code (e.g., JavaScript) that is provided with the markup code (e.g., Hyper Text Markup Language (HMTL) code) of each of the webpages. The page-specific imperative code of such webpages is configured to provide analytics information to remote analytics servers about the webpages that users access.
Conventional analytics tracking techniques are ill-suited for use in apps that provide content pages without page-specific imperative code. This is because such apps use imperative code to generically provide interactive functionality for multiple pages and this page-generic imperative code has limited access to the page specific-information needed for page tracking. Specifically, the generic imperative code cannot access page-specific information without attempting to access a rendered document object model (DOM) and/or using add-on functions to pass information back and forth between the individual pages and the imperative code. Implementing such access techniques would require complex, error prone, and time-consuming coding, making the use of imperative code for page tracking undesirable.
For example, Apple TV® apps present Apple's Television Markup Language (TVML)-defined pages without using page-specific imperative code. Instead, an Apple TV® app uses a JavaScript file that loads multiple TVML pages and responds to user input on those pages. A different TVML file is used to define the information and image elements that are displayed on the screen for each of the TVML pages. When a button is clicked, a link is clicked, or other event occurs on a page, the event is handled by the JavaScript file. However, because the JavaScript is not specific to the page, it cannot easily track a page access. For example, if a first page includes a list of products with links to additional pages of information about the products and a user selects a Product A link on the first page, the event is passed to a TVML renderer or core TVML and then passed to the app's JavaScript. The JavaScript receives the event and loads a next page identified by a Uniform Resource Locator for the page based on the link, but cannot easily identify the accessed page. Using conventional techniques to track information about the page, such as which product the page relates to and the type of the page, would require extensive coding. Such a requirement is burdensome on the app designer, inefficient, error prone, and otherwise undesirable.